package com.xb.sourest.ui;

import android.util.Log;
import android.view.View;

import com.xb.sourest.R;
import com.xb.sourest.adapter.BannerAdapter;
import com.xb.sourest.base.BaseChildLazyfragment;
import com.xb.sourest.base.BaseLazyFragment;
import com.xb.sourest.bean.BannerBean;
import com.zhpan.bannerview.BannerViewPager;
import com.zhpan.bannerview.BaseBannerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * 首页
 */
public  class HomeFragment extends BaseLazyFragment {

    @BindView(R.id.bannerviewpager)
    BannerViewPager<BannerBean> bannerViewPager;
    private List<BannerBean> mBannerBean = new ArrayList<>();


    @Override
    protected void initData() {

    }

    @Override
    protected int initLayoutRes() {
        return R.layout.fragment_home;
    }



    @Override
    protected void loadData() {
        //初始化
        bannerViewPager.setLifecycleRegistry(getLifecycle())
                .setAdapter(new BannerAdapter())
                .create();
        mBannerBean.clear();
        //Todo()网络请求数据  模拟
        BannerBean bannerBean1 = new BannerBean();
        bannerBean1.setImageId("1");
        bannerBean1.setImage("https://src.mcool.com/data/attachment/forum/202107/26/191607xjf66aaa6n2z8paf.JPG-cover");
        mBannerBean.add(bannerBean1);
        BannerBean bannerBean2 = new BannerBean();
        bannerBean2.setImageId("2");
        bannerBean2.setImage("https://src.mcool.com/data/attachment/forum/201903/21/225104m3mzvyqxnr4gg0yy.jpg-photo");
        mBannerBean.add(bannerBean2);
        BannerBean bannerBean3 = new BannerBean();
        bannerBean3.setImageId("3");
        bannerBean3.setImage("https://src.mcool.com/data/attachment/forum/201802/04/212902yv8c6zlp68hd69lr.jpg-photo");
        mBannerBean.add(bannerBean3);
        //刷新数据
        bannerViewPager.refreshData(mBannerBean);

    }

    @Override
    protected void upView() {

    }
}
